import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.Function;

public class Test08 {
    public static void main(String[] args) {
        ArrayList<Student> list=new ArrayList<>();
        list.add(new Student("lisi",24));
        list.add(new Student("zhangsan",23));
        list.add(new Student("wangwu",25));
        String[] arr=list.stream().map(new Function<Student, String>() {
            @Override
            public String apply(Student stu){
                return stu.getName();
            }
        }).toArray(String[]::new);
       String[] arr1= list.stream().map(Student::getName).toArray(String[]::new);
        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.toString(arr1));
    }
}
